# -*- coding: utf-8 -*-
#
# @Time    ： 2021/5/15  8:50
# @Auther  ： 徐良
# File     :  bioDialog.py

from PySide6.QtWidgets import QMessageBox


from PySide6.QtWidgets import QMessageBox, QApplication
from PySide6.QtGui import QIcon

class Infomation:

    @staticmethod
    def info(msg):
        msg_box = QMessageBox()
        msg_box.setIcon(QMessageBox.Information)
        msg_box.setText(msg)
        msg_box.setWindowTitle('薇天食品')
        msg_box.setWindowIcon(QIcon('resource/images/未来.png'))  # Set the window icon here
        msg_box.exec_()

    @staticmethod
    def warn(msg):
        app = QApplication.instance()
        if app is None:
            app = QApplication([])
        app.setWindowIcon(QIcon('resource/images/未来.png'))  # 设置应用程序窗口图标
        reply = QMessageBox.warning(None, "薇天食品", msg, QMessageBox.Yes | QMessageBox.No)
        return reply

    @staticmethod
    def question(msg):
        msg_box = QMessageBox()
        msg_box.setIcon(QMessageBox.Question)
        msg_box.setText(msg)
        msg_box.setWindowTitle('薇天食品')
        msg_box.setWindowIcon(QIcon('resource/images/未来.png'))  # Set the window icon here
        msg_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
        result = msg_box.exec_()
        return result

    @staticmethod
    def critical(msg):
        msg_box = QMessageBox()
        msg_box.setIcon(QMessageBox.Critical)
        msg_box.setText(msg)
        msg_box.setWindowTitle('薇天食品')
        msg_box.setWindowIcon(QIcon('resource/images/未来.png'))  # Set the window icon here
        msg_box.exec_()

    @staticmethod
    def about(msg):
        msg_box = QMessageBox()
        msg_box.setIcon(QMessageBox.Information)
        msg_box.setText(msg)
        msg_box.setWindowTitle('薇天食品')
        msg_box.setWindowIcon(QIcon('resource/images/未来.png'))  # Set the window icon here
        msg_box.exec_()

    @staticmethod
    def ask(msg, buttons=None):
        msg_box = QMessageBox()
        msg_box.setIcon(QMessageBox.Information)
        msg_box.setText("请选择：")
        msg_box.setWindowTitle('薇天食品')
        msg_box.setWindowIcon(QIcon('resource/images/未来.png'))  # Set the window icon here

        for btn_text in buttons:
            msg_box.addButton(btn_text, QMessageBox.YesRole)

        return msg_box.exec_()
